package org.mspring.mlog.service;

import org.mspring.mlog.dao.RoleResourceEntityDao;
import org.mspring.mlog.entity.RoleResourceEntity;
import org.mspring.nbee.common.PageResult;
import org.mspring.nbee.db.dao.sql.builder.part.condition.SqlCondition;
import org.mspring.nbee.db.dao.sql.pager.SqlPager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Gao Youbo
 * @since 2014-09-10 12:44:49
 */
@Service
public class RoleResourceEntityService {

    private static final Logger LOG = LoggerFactory.getLogger(RoleResourceEntityService.class);

    private RoleResourceEntityDao roleResourceEntityDao;

    public RoleResourceEntity findById(long id) {
        return roleResourceEntityDao.findById(id);
    }

    public PageResult<RoleResourceEntity> list(List<SqlCondition> conditions, SqlPager pager) {
        return roleResourceEntityDao.listPage(conditions, pager);
    }

    @Transactional
    public boolean update(RoleResourceEntity roleResource) {
        return roleResourceEntityDao.update(roleResource);
    }

    @Transactional
    public boolean deleteById(long id) {
        return roleResourceEntityDao.deleteById(id);
    }

    @Autowired
    public void setRoleResourceEntityDao(RoleResourceEntityDao roleResourceEntityDao) {
        this.roleResourceEntityDao = roleResourceEntityDao;
    }

}